#include "manager_mode_impl.h"
void ManagerModeImpl::load(vector<Manager>& mgrArr)
{
	ifstream ifs("managers.dat");
	if(!ifs.is_open())
	{
		cout << "打开失败!" << endl;
		return;
	}
	//vector<Department>:: iterator it = dpm.begin();
	while(true)
	{
		Manager* man = new Manager;
		ifs >> *man;
		if(!ifs.good())
		{
			//delete dp;
			break;
		}
		mgrArr.push_back(*man);
	}
	ifs.close();
}
void ManagerModeImpl::save(vector<Manager>& mgrArr)
{
	ofstream ofs("managers.dat");
	if(!ofs.is_open())
	{
		cout << "保存失败!" << endl;
		return;
	}
	vector<Manager>::iterator it = mgrArr.begin();
	for(int i=0;i<mgrArr.size();i++)
	{
		ofs << mgrArr[i];
	}
	
	ofs.close();
}
